<?php
include_once "checkAuth.php";
include_once "/CommonClass/errorcode.php";

function removeShift($userAuthName, $userAuthPassHash, $roleID, $dateID, $empID)
{
	if(checkAuthentication($userAuthName, $userAuthPassHash)){
		$link = mysqli_connect("localhost", "root", "", "paradigmshift_dev");

		if(mysqli_connect_errno()){
			return array($err::failRead);
		}
		else {
			$query = "DELETE FROM roleDate WHERE roleID='". $roleID ."' AND dateID='". $dateID ."' AND empID='". $empID ."'";
			if (mysqli_query($link, $query))
			{
				mysqli_close($link);
				return array(ErrorCode::successDelete);
			}
			else {
				mysqli_close($link);
				return array(ErrorCode::failDelete);
			}
		}
	}
	else {
		return array(ErrorCode::authFailRead);
	}
}

?>